package lu.med.praxiswahl.wahlumed.client.rechnungen.op.model;

import java.util.ArrayList;

import lu.med.praxiswahl.wahlumed.client.rechnungen.op.view.BillItemListener;

public class BillItemModel
{

    private static ArrayList<BillItemListener> listener;
    private static long billNumber;
    
    public BillItemModel()
    {
	listener = new ArrayList<BillItemListener>();
    }
    
    public void addBillItemListener(BillItemListener listener)
    {
	BillItemModel.listener.add(listener);
    }
    public void removeBillItemListener(BillItemListener listener)
    {
	BillItemModel.listener.remove(listener);
    }
    
    public static void fireModelChanged()
    {
	for(BillItemListener l : listener)
	{
	    l.modelChangeAppend(billNumber);
	}
    }

    /**
     * @return the billNumber
     */
    public long getBillNumber()
    {
        return billNumber;
    }

    /**
     * @param billNumber the billNumber to set
     */
    public static void setBillNumber(long billNumber)
    {
        BillItemModel.billNumber = billNumber;
        BillItemModel.fireModelChanged();
    }
    
}
